package by.ins.webconsole.jsf.actions;

import javax.faces.bean.ManagedBean;
import javax.faces.bean.ManagedProperty;

import by.ins.app.AppHelper;
import by.ins.life.evolution.ILifeEvoluter;



@ManagedBean(name="viewLife")
public class ViewLifeAction extends ActionSupport{
	
	
	@ManagedProperty(name="evolutorName", value="")
	private String evolutorName;	
	
	private ILifeEvoluter liveEvoluter;
	
	public String getEvolutorName() {
		return evolutorName;
	}

	public void setEvolutorName(String evolutorName) {
		this.evolutorName = evolutorName;
	}
	
	public String exc(){
		bindContextParam();
		liveEvoluter = AppHelper.getLiveEvoluter(evolutorName);
		
		if(liveEvoluter == null){
			addError("Not found liveEvolutor name : " +evolutorName);
			return RESULT_ERROR;
		}
		
		return RESULT_SUCCESS;
	}
	
	public ViewLifeAction(){
		int i =0;
		i++;
		i++;
	}

	public ILifeEvoluter getLiveEvoluter() {
		return liveEvoluter;
	}

	public void setLiveEvoluter(ILifeEvoluter liveEvoluter) {
		this.liveEvoluter = liveEvoluter;
	}
	
	

}
